﻿using System.ComponentModel.DataAnnotations;
using System.Text;
Console.WriteLine("Input Numbers:");
string input = Console.ReadLine();
string[] inputs = input.Split(',');
if (inputs.Length > 1000)
{
    Console.WriteLine("Over Capacity");
    return;
}
int[] a = new int[inputs.Length];
for (int i = 0; i < a.Length; i++)
{
    try
    {
        a[i] = int.Parse(inputs[i]);

    }
    catch (Exception e)
    {
        Console.WriteLine("解析错误" + e.Message);

    }
    Console.WriteLine("The maximum number of these numbers :" + Max(a, a.Length));
    Console.WriteLine("The minimum number of these numbers :" + Min(a, a.Length));
    Console.WriteLine("The average of these numbers :" +Average(a, a.Length));
    Console.WriteLine("The sum number of these numbers :" + Sum(a, a.Length));
}

static int Sum(int[] a,int len)
{
    int sum = 0;
    for(int i=0; i<len; i++)
    {
        sum += a[i];
    }
    return sum;
}
static string   Average(int[] a, int len)
{
    int sum = Sum(a, len);
    string ave = ((float)sum / len).ToString("0.00");
    return ave;
}

static int Max(int[] a, int len)
{
    Array.Sort(a, 0, len);
    return a[len - 1];
}
static int Min(int[] a , int len)
{
    Array.Sort(a, 0, len);
    return a[0];
}
